<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'head.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	

  </head>
  
  <body>
    	<div class="ue-bar">
		<div class="ue-bar-warp">
			<div class="ue-bar-logo">
				<a href="#"> <img src="./img/logo.png" width="200px"
					alt="大学生交易平台" title="大学生交易平台">
				</a>
			</div>
			<div class="ue-bar-nav">
				<ul>
					<li id="one"><a  href="home.jsp">首页</a></li>
					<li id="two"><a href="goods!getAllGoodsByTime.action">所有闲置</a></li>
					<li id="three"><a href="needs!getPageNeeds.action">所有需求</a></li>
					<li id="four"><a href="goods!getGoodNeedByUserId.action">个人中心<span class="badge"
							style="background:green;margin-left:5px;">1</span></a></li>
				</ul>
				<form class="search" action="goods!SearchGood.action">
					<div class="search_input">
						<input type="text" name ="searchkeywords" class="form-control" placeholder="请输入关键字"/>
					</div>
					<button type="submit" class="btn btn-default">搜索</button>
				</form>
			</div>


			<div class="login">

				<c:choose>
					<c:when test="${empty sessionScope.user}">
						<a href="#" data-toggle="modal" data-target="#myModal">登录</a>
						<a href="#" data-toggle="modal" data-target="#myModal1">注册</a>
					</c:when>
					<c:otherwise>
						<a href="#">欢迎你，${sessionScope.user.username }</a>
						<a href="user!logout.action">注销</a>
					</c:otherwise>
				</c:choose>

			</div>


		</div>
	</div>

	<!-- Modal -->
	<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
		aria-labelledby="myModalLabel">
		<div class="modal-dialog" role="document">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-label="Close">
						<span aria-hidden="true">&times;</span>
					</button>
					<h4 class="modal-title" id="myModalLabel">登录您的账号</h4>
				</div>
				<div class="modal-body">
					<form class="form-horizontal" method="post" action="user!login.action">
						<div class="form-group">
							<label for="inputEmail3" class="col-sm-2 control-label">账号</label>
							<div class="col-sm-9">
								<input name="user.username" class="form-control"
									id="inputEmail3" placeholder="请输入您的账号" required>
							</div>
						</div>
						<div class="form-group">
							<label for="inputPassword3" class="col-sm-2 control-label">密码</label>
							<div class="col-sm-9">
								<input type="password" name="user.password" class="form-control"
									id="inputPassword3" placeholder="请输入您的密码" required>
							</div>
						</div>
						<div class="form-group">
							<div class="col-sm-offset-2 col-sm-8">
								<button type="submit" class="btn btn-primary btn-lg btn-block">登录</button>
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
	<!-- Modal -->
	<div class="modal fade" id="myModal1" tabindex="-1" role="dialog"
		aria-labelledby="myModalLabel">
		<div class="modal-dialog" role="document">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-label="Close">
						<span aria-hidden="true">&times;</span>
					</button>
					<h4 class="modal-title" id="myModalLabel">注册您的账号</h4>
				</div>
				<div class="modal-body">
					<form class="form-horizontal" method="post" action="user!addUser.action">
						<div class="form-group">
							<label for="inputEmail3" class="col-sm-2 control-label">账号</label>
							<div class="col-sm-9">
								<input name="user.username" class="form-control"
									id="inputEmail3" placeholder="请输入您的账号" required>
							</div>
						</div>
						<div class="form-group">
							<label for="inputPassword3" class="col-sm-2 control-label">密码</label>
							<div class="col-sm-9">
								<input type="password" name="user.password" class="form-control"
									id="inputPassword3" placeholder="请输入您的密码" required>
							</div>
						</div>
						<div class="form-group">
							<label for="inputPassword3" class="col-sm-2 control-label">确认密码</label>
							<div class="col-sm-9">
								<input type="password" class="form-control" id="inputPassword3"
									placeholder="请确认您的密码" required>
							</div>
						</div>

						<div class="form-group">
							<label for="inputPhonenumber" class="col-sm-2 control-label">手机</label>
							<div class="col-sm-9">
								<input name="user.phonenumber" class="form-control"
									id="inputEmail3" placeholder="请输入您的手机号码">
							</div>
						</div>

						<div class="form-group">
							<label for="inputQQ" class="col-sm-2 control-label">QQ</label>
							<div class="col-sm-9">
								<input name="user.qq" class="form-control" id="inputEmail3"
									placeholder="请输入您的qq号">
							</div>
						</div>

						<div class="form-group">
							<label for="inputPassword3" class="col-sm-2 control-label">性别</label>
							<div class="col-sm-9">
								<input type="radio" name="user.sex" value="男">男 <input
									type="radio" name="user.sex" value="女">女
							</div>
						</div>

						<div class="form-group">
							<div class="col-sm-offset-2 col-sm-8">
								<button type="submit" class="btn btn-primary btn-lg btn-block">提交</button>
							</div>
						</div>
						<input type="hidden" id="jspnumber" value="${jspnum}">
					</form>
				</div>
			</div>
		</div>
	</div>
	<script type="text/javascript">
	   var jspnum=document.getElementById("jspnumber").value;
	   if(jspnum==1){
		   document.getElementById("one").className="active";
	   }else if(jspnum==2){
		   document.getElementById("two").className="active";
	   }else if(jspnum==3){
		   document.getElementById("three").className="active";
	   }
		   
	
	</script>
  </body>
</html>
